<?php

/**
 * Name: 值班班长日志模型
 * User: Silent
 * Date: 2025-11-24
 */

namespace App\Models\Checkin;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Config\Employee;

class DutyLeaderLog extends Model
{
    use HasFactory, SoftDeletes;

    protected $table = 'duty_leader_logs';

    protected $guarded = [];

    protected $casts = [
        'duty_date' => 'date:Y-m-d',
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'deleted_at' => 'datetime:Y-m-d H:i:s',
    ];

    /**
     * 关联值班班长记录
     */
    public function dutyLeader()
    {
        return $this->belongsTo(DutyLeader::class, 'duty_leaders_id', 'id');
    }

    /**
     * 关联员工
     */
    public function employee()
    {
        return $this->belongsTo(Employee::class, 'employees_id', 'id');
    }
}
